<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="__PUBLIC__/bs/css/bootstrap.min.css">
	<link rel="stylesheet" href="../Public/css/index.css"><!--首页-->
	<link rel="stylesheet" href='../Public/css/shop.css'><!--商品详情-->
	<link rel="stylesheet" href='../Public/css/person.css'><!-- 个人中心 -->
	<script src="__PUBLIC__/bs/js/bootstrap.min.js"></script>
	<script src="__PUBLIC__/bs/js/jquery.js"></script>
</head>
<body>

	<div class="container">
		<!-- 登陆注册 -->
		<div class="top" style="margin-bottom: 1px;">
			<div class="left">
				<ul class='list-inline'>
				<li><a href="<?php echo U('Index/index');?>"><img src="../Public/image/top.png" style="height:28px;" alt=""></a></li>
				</ul>
			</div>
			<div class="right">
				<ul class="list-inline">
					<?php if($_SESSION['home_username']): ?><li>欢迎<?php echo ($_SESSION['home_username']); ?></li>
						<li><a href="<?php echo U('Login/logout');?>">退出</a></li>
					<?php else: ?>
						<li>请先 <a href="<?php echo U('Login/index');?>" style='color:red;'>登陆</a></li><?php endif; ?>
					<li><a href="<?php echo U('Person/index');?>">个人中心</a></li>
					<li><a href="<?php echo U('ShopCart/index');?>">购物车</a></li>
				</ul>
			</div>
		</div>
		<!-- 登陆注册   结束-->
		
	<!-- 页面详情 -->
	<div class="panel panel-primary">
	  <div class="panel-heading">
	  	<div class="row">
	  		<h3 class="col-md-2 panel-title">我的购物车</h3>
	  	</div>
	  </div>
	  <form action="<?php echo U('ShopCart/payAll');?>" method='post'>
	  <div class="panel-body ">
	  		<table class="table table-bordered">
	  			<tr class='warning'>
	  				<th class="text-center">商品</th>
	  				<th class="text-center">图片</th>
	  				<th class="text-center">价格</th>
	  				<th class="text-center">库存</th>
	  				<th class="text-center">数量</th>
	  				<th class="text-center">合计</th>
	  				<th class="text-center">删除</th>
	  			</tr>
	  			<?php if(is_array($shoprows)): $i = 0; $__LIST__ = $shoprows;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$shoprow): $mod = ($i % 2 );++$i;?><tr>
	  				<td class="text-center" style="line-height: 150px;"><?php echo ($shoprow['name']); ?></td>
	  				<td class="text-center" style="line-height: 150px;"><img src="__PUBLIC__/upload/shop/t_<?php echo ($shoprow['img']); ?>"></td>
	  				<td class="text-center" style="line-height: 150px;"><?php echo ($shoprow['price']); ?>元</td>
	  				<td class="text-center" style="line-height: 150px;"><?php echo ($shoprow['stock']); ?></td>
	  				<td class="text-center" style="line-height: 150px;">
	  					<a class="btn btn-default btn-sm"  href="<?php echo U('ShopCart/cut','','');?>/id/<?php echo ($shoprow['id']); ?>">-</a>
	  					<?php echo ($shoprow['num']); ?>
	  					<a class="btn btn-default btn-sm" href="<?php echo U('ShopCart/add','','');?>/id/<?php echo ($shoprow['id']); ?>">+</a>
	  				</td>
	  				<td class="text-center" style="line-height: 150px;"><?php echo $shoprow['price']*$shoprow['num']?>元</td>
	  				<td class="text-center" style="line-height: 150px;"><a href="<?php echo U('ShopCart/delete','','');?>/id/<?php echo ($shoprow['id']); ?>" class="btn btn-danger">删除</a></td>
	  			</tr>
	  			<!-- 计算购物车总金额 -->
	  			<?php
 $tot += $shoprow['price']*$shoprow['num']; endforeach; endif; else: echo "" ;endif; ?>
	  		</table>
	  		<div class="row" style="padding:5px;">
	  			<span class="col-md-3 text-right"><a href="<?php echo U('Index/index');?>"  class="btn btn-info">继续购物</a></span>
	  			<span class="col-md-3 "><a href="<?php echo U('ShopCart/delAll');?>" class="btn btn-danger">全部删除</a></span>
	  			<span class="col-md-4 text-center"><b>总计</b><?php echo ($tot?$tot:0); ?> <b>元</b></span>
	  			<span class="col-md-2 text-center"> <input type="submit" class="btn btn-info" value="提交订单"></span>
	  		</div>
			<div class="panel panel-info">
				<div class="panel-heading">
					<h4 class="panel-title">我的联系方式</h4>
				</div>
				<div class="panel-body">
					<?php if($_SESSION['home_username']): ?><table class="table table-bordered">
							<tr>
								<th>选择</th>
								<th>姓名</th>
								<th>地址</th>
								<th>电话</th>
								<th>邮箱</th>
							</tr>
							<?php if(is_array($touchrows)): $i = 0; $__LIST__ = $touchrows;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$touchrow): $mod = ($i % 2 );++$i; if($i == 1): ?><!-- 默认选中第一个 -->
							<tr>
								<td><input type="radio" name="touch" checked="checked" value="<?php echo ($touchrow['id']); ?>" ></td>
								<td><?php echo ($touchrow['name']); ?></td>
								<td><?php echo ($touchrow['add']); ?></td>
								<td><?php echo ($touchrow['tel']); ?></td>
								<td><?php echo ($touchrow['email']); ?></td>
							</tr>
							<?php else: ?>
							<tr>
								<td><input type="radio" name="touch"  value="<?php echo ($touchrow['id']); ?>" ></td>
								<td><?php echo ($touchrow['name']); ?></td>
								<td><?php echo ($touchrow['add']); ?></td>
								<td><?php echo ($touchrow['tel']); ?></td>
								<td><?php echo ($touchrow['email']); ?></td>
							</tr><?php endif; endforeach; endif; else: echo "" ;endif; ?>
						</table>
					<?php else: ?>
						<p>请先<b><a href="<?php echo U('Login/index');?>">登陆</a></b></p><?php endif; ?>
				</div>
			</div>
	  </div>
	  </form>
	</div>
	<!-- 页面详情   结束-->

		<!-- 页面底部 -->
		<div class="footer">
			<div class="row">
				<ul class="list-inline">
					<li class="col-md-3"><a href="">联系方式</a></li>
					<li class="col-md-3"><a href="">公司介绍</a></li>
					<li class="col-md-3"><a href="">公司地图</a></li>
					<li class="col-md-3"><a href="">合作伙伴</a></li>
				</ul>
			</div>
			
		</div>
		<!-- 页面底部  结束 -->
	</div>
</body>
<script>

$(function(){
	// 关闭广告按钮
	$('.ad .circle').click(function(){
		$('.ad').hide(350);
	})
	$('.l_ad .circle').click(function(){
		$('.l_ad').hide(350);
	})
})


</script>
</html>